﻿/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework
 * Version 2.10
 * 
 * Renderable Interface Definition
 *      Provides an interface definition for extended CodeDOM objects that may 
 * render code.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using Adaptive.Foundation;

namespace Adaptive.Foundation.CodeDom
{
    /// <summary>
    /// Provides an interface definition for extended CodeDOM objects that may 
    /// render code,
    /// </summary>
    public interface IRenderable
    {
        /*--------------------------------------------------------------------------------
         * Event Definitions
         *------------------------------------------------------------------------------*/
        #region Event Definitions
        /// <summary>
        /// Occurs before rendering begins.
        /// </summary>
        event EventHandler RenderBegin;
        /// <summary>
        /// Occurs once rendering completes.
        /// </summary>
        event EventHandler RenderEnd;
        /// <summary>
        /// Occurs when an exception is caught during rendering,
        /// </summary>
        event ExceptionEventHandler RenderException;
        #endregion

        /*--------------------------------------------------------------------------------
         * Properties
         *------------------------------------------------------------------------------*/
        #region Properties
        /// <summary>
        /// Gets or sets the number of tabs to use when rendering text.
        /// </summary>
        /// <value>
        /// The number of tab indentations to use.
        /// </value>
        int TabIndex { get; set; }
        #endregion

        /*--------------------------------------------------------------------------------
         * Methods / Functions
         *------------------------------------------------------------------------------*/
        #region Methods / Functions
        /// <summary>
        /// Renders the item into the specified language.
        /// </summary>
        /// <param name="language">
        /// A <see cref="VisualStudioLanguages"/> enumerated value 
        /// indicating the language to render into.
        /// </param>
        /// <returns>
        /// The rendered text or an empty string.
        /// </returns>
        string Render(VisualStudioLanguages language);
        /// <summary>
        /// Renders the item using the specified code provider.
        /// </summary>
        /// <param name="language">
        /// An <see cref="ICodeGenerator"/> implementation used 
        /// to render text.
        /// </param>
        /// <returns>
        /// The rendered text or an empty string.
        /// </returns>
        string Render(ICodeGenerator generator);
        #endregion
    }
}